package com.colorsstudio.defence.Levels 
{
	import com.colorsstudio.defence.ConstantValues.Constants;
	import com.colorsstudio.defence.flashExportClass.f_btnBack;
	import com.colorsstudio.defence.flashExportClass.f_btnEffectOn;
	import com.colorsstudio.defence.flashExportClass.f_btnMusicOn;
	import com.colorsstudio.defence.flashExportClass.f_btnSoundOn;
	import flash.display.SimpleButton;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import idv.cjcat.fenofsm.events.StateEvent;
	import idv.cjcat.fenofsm.Transition;
	/**
	 * ...
	 * @author wuzhida
	 */
	public class SettingScene extends Level 
	{
		public var t_startScreen_settingScene:Transition;
		public var t_settingScene_startScreen:Transition;
		
		//设置四个按钮：效果、声音、音乐、后退
		public var btnEffectOn:SimpleButton;
		public var btnEffectOff:SimpleButton;
		public var btnMusicOn:SimpleButton;
		public var btnMusicOff:SimpleButton;
		public var btnSoundOn:SimpleButton;
		public var btnSoundOff:SimpleButton;
		public var btnBack:SimpleButton;

		
		public function SettingScene() 
		{
			super();
		}
		
		override public function setState():void 
		{
			state = Constants.fsm.createState("SettingScene");
			t_startScreen_settingScene = Constants.fsm.createTransition(Constants.fsm.getStateByName("startScreen"), state, "toSettingScene", "t_startScreen_settingScene", 0);
			t_settingScene_startScreen = Constants.fsm.createTransition(state, Constants.fsm.getStateByName("startScreen"), "settingBackTostartScreen", "t_settingScene_startScreen", 0);
			
			super.setState();
		}
		
		override public function levelStart(e:StateEvent):void 
		{
			super.levelStart(e);
			trace("Now the setting Scene is enter!");
			Constants.main.addChild(this);
			thisLevelGosHere();			
		}
		
		public function thisLevelGosHere():void 
		{
			//处理背景和四个按钮。添加到不同layer1、2
			btnEffectOn= new f_btnEffectOn();			
			this.layer2.addChild(btnEffectOn);
			
			btnMusicOn = new f_btnMusicOn();
			this.layer2.addChild(btnMusicOn);
			
			btnSoundOn = new f_btnSoundOn();
			this.layer2.addChild(btnSoundOn);
			
			btnBack = new f_btnBack();
			this.layer2.addChild(btnBack);
			
			//添加按钮事件
			btnEffectOn.addEventListener(MouseEvent.CLICK, clickEffectOn);
			btnMusicOn.addEventListener(MouseEvent.CLICK, clickMusicOn);
			btnSoundOn.addEventListener(MouseEvent.CLICK, clickSoundOn);
			btnBack.addEventListener(MouseEvent.CLICK, clickBack);		
		}
		
		private function clickBack(e:Event):void 
		{
			Constants.fsm.input("settingBackTostartScreen");
		}
		
		private function clickSoundOn(e:Event):void 
		{
			
		}
		
		private function clickMusicOn(e:Event):void 
		{
			
		}
		
		private function clickEffectOn(e:Event):void 
		{
			
		}
		
		override public function levelEnd(e:StateEvent):void 
		{
			super.levelEnd(e);
			Constants.main.removeChild(this);
		}
	}

}